import * as THREE from "three";
import { createRect } from "./geometry"

/**
 * size 长宽，像素单位
 * imgSize 图片总长宽
 */
export function parsePort({ size, imgSize, box }) {
    const boxSize = box.getSize(new THREE.Vector3())
    let port = createRect({
        size: [
            (size[0] / imgSize[0]) * boxSize.z,
            (size[1] / imgSize[1]) * boxSize.y,
        ],
    })
    port.type = "Port"
    return port
}
